package com.chilli.cosima.common;

import java.util.List;

import com.opensymphony.xwork2.ActionContext;

public class Auther
{

	public static final String USER_QUERY = "020101";

	public static final String USER_ADD = "020102";

	public static final String USER_EDIT = "020103";

	public static final String USER_DEL = "020104";

	public static final String ROLE_QUERY = "020201";

	public static final String ROLE_ADD = "020202";

	public static final String ROLE_EDIT = "020203";

	public static final String ROLE_DEL = "020204";

	public static final String RUNLOG_QUERY = "030101";

	public static final String RUNLOG_EDIT = "030102";

	public static final String RUNLOG_DOWNLOAD = "030103";

	public static final String RUNLOG_DEL = "030104";

	public static final String PROVIDER_DETAIL = "0401";

	public static final String PROVIDER_ADD = "0402";

	public static final String PROVIDER_DEL = "0403";

	public static final String PROVIDER_EDIT = "0404";

	public static final String CUSTOMER_DETAIL = "0501";

	public static final String CUSTOMER_QUERY = "0502";

	public static final String CUSTOMER_ADD = "050101";

	public static final String CUSTOMER_EDIT = "050102";

	public static final String CUSTOMER_DEL = "050103";

	@SuppressWarnings("unchecked")
	public static boolean isPermitted(String powerid)
	{
		List<String> powerIdListWithButton = (List<String>) ActionContext
				.getContext().getSession().get("powerIdListWithButton");
		if (powerIdListWithButton != null
				&& powerIdListWithButton.contains(powerid.trim()))
		{
			return true;
		} else
		{
			return false;
		}
	}
}
